<!DOCTYPE html>
<html class="x-admin-sm">

<head>
  <meta charset="UTF-8">
  <title>查询出入库记录</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <link rel="stylesheet" href="../../css/font.css">
  <link rel="stylesheet" href="../../css/xadmin.css">
  <script src="../../lib/layui/layui.js" charset="utf-8"></script>

  <script src="https://cdn.bootcss.com/moment.js/2.23.0/moment.min.js
		" type="text/javascript" charset="utf-8"></script>
  <script src="../../lib/layui/lay/modules/layer.js" type="text/javascript" charset="utf-8"></script>
  <script src="../../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
  <script src="../../js/app.js" type="text/javascript" charset="utf-8"></script>
  <style type="text/css">
    #page {
      display: flex;
      justify-content: center;
    }
  </style>
</head>

<body>
  <div class="x-nav">
    <span class="layui-breadcrumb">
      <a href="">首页</a>
      <a href="">演示</a>
      <a>
        <cite>导航元素</cite></a>
    </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
      onclick="location.reload()" title="刷新">
      <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
  </div>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-body ">

            <div class="layui-collapse" lay-filter="test">
              <div class="layui-colla-item">
                <h2 class="layui-colla-title">条件筛选<i class="layui-icon layui-colla-icon"></i></h2>
                <div class="layui-colla-content  layui-show">
                  <form class="layui-form layui-col-space5" action="">

                    <div class="layui-input-inline layui-show-xs-block">
                      <select name="category" id="category" lay-filter="category">
                        <option value=""></option>
                      </select>
                    </div>
                    <div class="layui-input-inline layui-show-xs-block" style="">
                      <select name="brand" id="brand" lay-filter="brand">

                      </select>
                    </div>
                    <div class="layui-input-inline layui-show-xs-block">
                      <select name="typical" id="typical" lay-filter="typical">

                      </select>
                    </div>
                    <div class="layui-input-inline layui-show-xs-block">
                      <select name="model" id="model">

                      </select>
                    </div>

                    <div class="layui-input-inline">
                      <input type="text" name="serial_number" placeholder="串号" autocomplete="off" class="layui-input"
                        id="serial_number">
                    </div>

                    <div class="layui-input-inline">
                      <input type="text" name="operatorUsername" placeholder="操作人员名字" autocomplete="off"
                        class="layui-input" id="operatorUsername">
                    </div>

                    <!--											<div class="layui-input-inline layui-show-xs-block">-->
                    <!--												<select name="sourceRepositoryName" id="sourceRepositoryName" lay-filter="sourceRepositoryName">-->

                    <!--												</select>-->
                    <!--											</div>-->

                    <!--											<div class="layui-input-inline layui-show-xs-block">-->
                    <!--												<select name="targetRepositoryName" id="targetRepositoryName" lay-filter="targetRepositoryName">-->

                    <!--												</select>-->
                    <!--											</div>-->

                    <div class="layui-input-inline">
                      <input type="text" id="Time" name="Time" placeholder="请选择日期" autocomplete="off"
                        class="layui-input">
                    </div>


                    <div class="layui-inline layui-show-xs-block">
                      <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon"
                          id="Search">&#xe615;</i>查询</button>
                    </div>
                  </form>
                </div>
              </div>
            </div>

          </div>
          <div class="layui-card-body ">
            <table class="layui-table layui-form">
              <thead id="Thead" class="layui-hide">
                <tr>
                  <th>种类名</th>
                  <th>说明</th>
                  <th>品牌</th>
                  <th>入库时间</th>
                  <th>操作者</th>
                  <th>城市</th>
                  <th>来源仓库</th>
                  <th>目标仓库</th>
                  <th>型号</th>
                  <th id="unit">产品名(单位)</th>
                </tr>
              </thead>
              <tbody id="Tbody">
              </tbody>
            </table>
          </div>
          <!-- <div class="layui-card-body" id="page">
            <div id="demo7">
              <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-10"><span
                  class="layui-laypage-count">共
                  100 条</span><a href="javascript:;" class="layui-laypage-prev layui-disabled"
                  data-page="0">上一页</a><span class="layui-laypage-curr"><em
                    class="layui-laypage-em"></em><em>1</em></span><a href="javascript:;" data-page="2">2</a><a
                  href="javascript:;" data-page="3">3</a><a href="javascript:;" data-page="4">4</a><a
                  href="javascript:;" data-page="5">5</a><span class="layui-laypage-spr">…</span><a href="javascript:;"
                  class="layui-laypage-last" title="尾页" data-page="10">10</a><a href="javascript:;"
                  class="layui-laypage-next" data-page="2">下一页</a><span class="layui-laypage-limits"><select
                    lay-ignore="">
                    <option value="10" selected="">10 条/页</option>
                    <option value="20">20 条/页</option>
                    <option value="30">30 条/页</option>
                    <option value="40">40 条/页</option>
                    <option value="50">50 条/页</option>
                  </select></span><a href="javascript:;" data-page="1" class="layui-laypage-refresh"><i
                    class="layui-icon layui-icon-refresh"></i></a><span class="layui-laypage-skip">到第<input type="text"
                    min="1" value="1" class="layui-input">页<button type="button"
                    class="layui-laypage-btn">确定</button></span></div>
            </div>
          </div> -->
        </div>
      </div>
    </div>
  </div>
</body>
<script src="Query.js" type="text/javascript" charset="utf-8"></script>
<script>
  layui.use(['laydate', 'form', 'layer', 'element'], function () {
    var laydate = layui.laydate;
    var form = layui.form;
    var layer = layui.later;
    var element = layui.element;

    var Tbody = document.getElementById("Tbody");
    var category = document.getElementById("category");
    var brand = document.getElementById("brand");
    var typical = document.getElementById("typical");
    var Search = document.getElementById("Search");
    var UserInfo = app.getUserGlobalInfo()

    form.on('submit(sreach)', function (data) {
      var Info = data.field;
      // console.log(Info)
      $.ajax({
        url: app.ServerUrl + 'v1/material/getInStorageRecordsByCondition',
        // url:'http://10.4.208.162:8080/v1/material/getInStorageRecordsByCondition',
        type: "post",
        dataType: "json",
        async: true,
        headers: {
          "Authorization": "460bcdb0-b326-4d6d-ac99-232c83ba6d80"
        },
        data: {
          IMEI: Info.serial_number,
          brand: Info.typical,
          // inTime:Info.Time == "" ? null :Info.Time,
          operatorUsername: Info.operatorUsername,
          roleId: UserInfo.roleId,
          // sourceRepositoryId:Info.sourceRepositoryName,
          // targetRepositoryId:Info.targetRepositoryName,
          typicalModel: Info.model,
          typicalName: Info.brand,

        },
        success: function (data) {
          // console.log(data)
          var result = data.objs[0];
          if (result == '') {
            layer.msg('没有查找到相关的数据！')
            // layer.open({
            // 	content: '填入信息有误！请检查填写内容是否正确',
            // 	btnAlign: 'c',
            // 	anim: 5,
            // 	icon: 5,
            // 	cancel: function() {}
            // });
          } else {
            $('#Thead').removeClass('layui-hide')
            unit.innerText = "产品名(" + result[0].unit + ")";
            var QueryAllHtml = "";
            for (let i = 0; i < result.length; i++) {
              var singleInfo = result[i];
              var inTime = app.getFormatDate(singleInfo.inTime);
              QueryAllHtml +=
                '<tr>' +
                '<td>' + singleInfo.categoryName + '</td>' +
                '<td>' + singleInfo.categoryContext + '</td>' +
                '<td>' + singleInfo.brand + '</td>' +
                '<td>' + inTime + '</td>' +
                '<td>' + singleInfo.operatorUsername + '</td>' +
                '<td>' + singleInfo.role + '</td>' +
                '<td>' + singleInfo.sourceRepository + '</td>' +
                '<td>' + singleInfo.targetRepository + '</td>' +
                '<td>' + singleInfo.typicalModel + '</td>' +
                '<td>' + singleInfo.typicalName;
              if (singleInfo.count != null && singleInfo.count != '') {
                QueryAllHtml += "(" + singleInfo.count + ")"
              }
              QueryAllHtml +=
                '</td>' +
                '</td>' +
                '</tr>'
            }
            Tbody.innerHTML = QueryAllHtml;
          }

        },
        error: function (e) {
          console.log(e.statusText)
        }
      })
      return false;
    })

    //执行一个laydate实例
    laydate.render({
      elem: '#Time' //指定元素
    });

    //执行一个laydate实例
    laydate.render({
      elem: '#end' //指定元素
    });

  });
</script>
<script>
  var _hmt = _hmt || [];
  (function () {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
</script>
<script type="text/javascript" src="../../js/xadmin.js"></script>

</html>